package com.ssm.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;

@Data
public class Product {

  private String id;
  private String productNum;
  private String productName;
  private String cityName;
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
  private java.util.Date departureTime;
  private String departureTimeStr;//格式化后展示
  private Double productPrice;
  private String productDesc;
  private Integer productStatus;
  private String productStatusStr;//格式化后展示


  public String getProductStatusStr() {
    if (productStatus==0){
      productStatusStr="关闭";
    }else if (productStatus==1){
      productStatusStr="开启";
    }else {
      productStatusStr="未知";
    }
    return productStatusStr;
  }

  public String getDepartureTimeStr() {
    if (departureTime!=null){
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     departureTimeStr= sdf.format(departureTime);
    }
    return departureTimeStr;
  }
}
